package homework08;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Seven02 {
	public static void main(String args[]){
		Set<String> words = new TreeSet<>();
		Scanner sc = new Scanner(System.in);
		while(true){
			String word = new String();
			word=sc.next();
			if(word.equals("!!!!!"))
				break;
			else words.add(word);
		}
		System.out.println(words.size());
		int count=0;
		if(words.size()<=10)		{
			for(String e : words){
				System.out.println(e);
			}
		}
		
		else {
			for(String e : words){
				System.out.println(e);
				count++;
				if(count==10) break;
			}
		}
		
				
		
		sc.close();
	}
}
